import { definePropType } from '@/utils'

export default {
  fields: definePropType<Record<string, any>>(Array),
  //   数据回显，仅此初始化， 否则不生效
  defaultValue: {
    type: Object,
    default: () => {}
  },
  // 数据回显
  value: {
    type: Object,
    default: () => {}
  },
  httpGet: Function,
  httpAdd: Function,
  httpEdit: Function,
  // 自行配置处理编辑的参数
  handler: Function,
  // 自行配置处理获取的参数
  getHandler: Function,
  successMsg: {
    type: String,
    default: '操作成功'
  },
  addTitle: {
    type: String,
    default: '新增'
  },
  editTitle: {
    type: String,
    default: '编辑'
  },
  viewTitle: {
    type: String,
    default: '查阅'
  },
  submitText: {
    type: String,
    default: '提交'
  },
  cancelText: {
    type: String,
    default: '取消'
  },
  isViews: {
    type: Boolean,
    default: false
  },
  width: {
    type: String,
    default: '40%'
  },
  btnsFlex: {
    type: String,
    default: 'center'
  }
} as const

export const emit = {
  reload: () => true
}
